<div class="row">
    <div class="col-xs-12">
        <div class="box box-primary">
            <div class="box-header">
                <h3 class="box-title">管理员列表</h3>
                <div class="box-tools">
                  <form class="form-horizontal">
                    <div class="input-group input-group-sm" style="width: 300px;">
                        @if(isset($mark))
                          <input id="sinput" type="text" name="table_search" class="form-control pull-right" placeholder="请输入用户名" value="{{$mark}}">
                          @else
                          <input id="sinput" type="text" name="table_search" class="form-control pull-right" placeholder="请输入用户名" value="">
                          @endif
                        <div class="input-group-btn">
                            <button id="searchb-3" type="button" class="btn btn-primary" data-url="{{ url('admin/adminuser') }}" data-type="get" style="margin-right: 10px" onclick="getfun(this)"><i class="fa fa-search"></i></button>
                        </div>
                    </div>
                    </form>
                </div>
            </div>
            <!-- /.box-header -->
            <div class="box-body table-responsive no-padding">
                <table class="table table-hover">
                    <tr>
                        <th>ID</th>
                        <th>用户名</th>
                        <th>姓名</th>
                        <th>邮箱</th>
                        <th>创建时间</th>
                        <th>最后登录IP</th>
                        <th>状态</th>
                        <th>&nbsp;&nbsp;&nbsp;&nbsp;操作</th>
                        <th>
                          <button style="float:right;margin-right:10px;" class="btn btn-success btn-sm" data-url="{{ url('/admin/adminuser/create') }}" onclick="jumpfun(this)">添加管理员</button>
                        </th>
                    </tr>
                    @foreach($adminusers as $admin)
                    <tr>
                        <td>{{ $admin->id }}</td>
                        <td>{{ $admin->username }}</td>
                        <td>{{ $admin->name }}</td>
                        <td>{{ $admin->email }}</td>
                        <td>{{ $admin->created_at }}</td>
                        <td>{{ $admin->login_ip }}</td>
                        <td>
                            @if($admin->status == 1)
                            <span class="label label-success">正常</span>
                            @elseif($admin->status == 0)
                            <span class="label label-danger">禁用</span>
                            @endif
                        </td>
                        <td>
                          @if($admin->id == 1 )
                            @if(Auth::guard('admin')->id() == 1)
                            <a style="margin:3px;" href="javascript:void(0)" data-url="{{ url('/admin/adminuser', $admin->id) }}" onclick="jumpfun(this)" class="X-Small btn-xs text-primary "><i class="fa fa-eye"></i> 查看</a>
                            <a style="margin:3px;" href="javascript:void(0)" data-url="{{ url('/admin/adminuser/'.$admin->id.'/edit') }}" onclick="jumpfun(this)" class="X-Small btn-xs text-success "><i class="fa fa-edit"></i> 编辑</a>
                            @endif
                          @else
                          <a style="margin:3px;" href="javascript:void(0)" data-url="{{ url('/admin/adminuser', $admin->id) }}" onclick="jumpfun(this)" class="X-Small btn-xs text-primary "><i class="fa fa-eye"></i> 查看</a>
                          <a style="margin:3px;" href="javascript:void(0)" data-url="{{ url('/admin/adminuser/'.$admin->id.'/edit') }}" onclick="jumpfun(this)" class="X-Small btn-xs text-success "><i class="fa fa-edit"></i> 编辑</a>
                          @endif
                            @if ($admin->id != 1)
                                <a style="margin:3px;" href="javascript:void(0)" data-url="{{ url('/admin/adminuser', $admin->id) }}" onclick="delfun(this)" class="X-Small btn-xs text-danger "><i class="fa fa-edit"></i> 删除</a>
                            @endif
                        </td>
                    </tr>
                    @endforeach
                    @if(!$adminusers->count())
                    <tr>
                      <td colspan="8" style="text-align:center;">暂无数据</td>
                    </tr>
                    @endif
                </table>
            </div>
            <div class="box-footer clearfix">
                <ul class="pagination pagination-sm no-margin pull-right">
                      {!! $adminusers->links('vendor.pagination.pages') !!}
                </ul>
            </div>
            <!-- /.box-body -->
        </div>
        <!-- /.box -->
    </div>
</div>
<script type="text/javascript">
$(function(){
      $("#sinput").keydown(function(event){
          if(event.keyCode==13){
            // 阻止页面刷新
              event.preventDefault();
            //回车键提交搜索内容
              $("#searchb-3").click();
          }
      });
})
</script>
